def oi_way(res):
	"""Counts ratio for results, like on polish Olimpics in Informatics
	res -- list of tuples like (status,time,maxTime)"""

	if len(res) == 0:
		return 0.0
	rat = 0.0
	for r in res:
		if r[0] != 0:
			return 0.0
		elif 2*r[1] < r[2]:
			rat += 1.0
		#after half-time we cut points
		elif r[1] < r[2]:
			rat += 2.0 - 2.0*float(r[1])/float(r[2])
	rat /= len(res)
	return rat

def acm_way(res):
	"""Counts ratio for results, like on ACM - all tests 0
	res -- list of tuples like (status,time,maxTime)"""
	if len(res) == 0:
		return 0.0
	for r in res:
		if r[0] != 0:
			return 0.0
	return 1.0		

goalScoringWays = [oi_way,acm_way]
